package com.day13.staticdemo;

public class ArrayUtil {
    private ArrayUtil(){

    }
    public static String printArr(int[] arr){
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        int index = arr.length;
        for (int i = 0; i < index; i++) {
            if (i == index-1){
                sb.append(arr[i] + "]");
            }else {
                sb.append(arr[i]+ ",");
            }
        }
        return sb.toString();
    }

    public static double getAverage(double[] arr){
        double sum = 0.0;
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        return sum/arr.length;
    }


}
